﻿<link href="@Url.Content("~/content/activitie_detail.css")" rel="stylesheet" type="text/css" />

@model PessMvc.Models.ExportArchiveListModel

@{
    ViewBag.Title = "ExportArchiveList";
}

<div id="m-title">
    <h2>导出档案列表</h2>
    <div id="m-op">
        @Html.ActionLink("返回", "Index", "Archive", new { activityID = (int)ViewBag.ActivityID }, null)
    </div>
</div>

<fieldset class="fly-edit fly-edit-ep">
    @using (Html.BeginForm("ExportArchiveList", "Archive", FormMethod.Post))
    {
        @Html.Hidden("ActivityID", (int)ViewBag.ActivityID)

        <div class="editor-label">
            学科：
        </div>
        <div class="editor-field">
            @Html.DropDownList("SubjectID", (SelectList)ViewBag.SubjectID)    <input type="submit" value="预览" class="u-btn u-btn-save3" />
        </div>

        <div class="editor-label">
        </div>
        <div class="editor-field">
            @for (int i = 0; i < Model.Properties.Count; i++)
            {
                <span>
                    @Html.CheckBoxFor(m => Model.Properties[i].IsSelected, new { @class="u-chk"})
                    @Model.Properties[i].LocalName
                </span>
                @Html.HiddenFor(m => Model.Properties[i].Id)
                @Html.HiddenFor(m => Model.Properties[i].Name)
                //string.Format("ArchiveProperty[{0}].Name",i)

            }
        </div>
    }
    @*<div>
        @Html.ActionLink("保存为Excel","Report","Archive",new {activityID=(int)ViewBag.ActivityID, SelectedProperties=Model.SelectedProperties},null)
        </div>*@
</fieldset>
<fieldset class="fly-edit fly-edit-ep">
    @using (Html.BeginForm("Report", "Archive"))
    {
        @Html.Hidden("ActivityID", (int)ViewBag.ActivityID)
        @Html.Hidden("SubjectID", Model.SelectedSubjectID)
        for (int i = 0; i < Model.SelectedProperties.Count(); i++)
        {
            @Html.HiddenFor(m => Model.SelectedProperties[i])
        }
        
        <div class="editor-label">
        </div>
        <div class="editor-field">
            <input type="submit" value="下载Excel" class="u-btn u-btn-save3 dlExecl" />
        </div>
    }

    @using (Html.BeginForm("DownloadArchives", "Archive"))
    {
        @Html.Hidden("ActivityID", (int)ViewBag.ActivityID)
        @Html.Hidden("SubjectID", Model.SelectedSubjectID)
        <div class="editor-label">
        </div>
        <div class="editor-field">
            <input type="submit" value="下载档案文件包" class="u-btn u-btn-save3 dlExec2" style="width:130px;" />
        </div>
    }
</fieldset>
<fieldset class="fly-edit fly-edit-ep">

    @{
        var grid = new WebGrid(Model.Archives.ToList(), canPage: false);
    }
    @grid.GetHtml(columns: (from c in grid.Columns(
     grid.Column("SubjectName", PessResources.Archive.SubjectName),
     grid.Column("CountyName", PessResources.Archive.CountyName),
     grid.Column("CountyCode", PessResources.Archive.CountyCode),
     grid.Column("SchoolComment", PessResources.Archive.SchoolComment, format: (item) => { return Html.Raw(item.SchoolComment); }),
     grid.Column("CountyEBComment", PessResources.Archive.CountyEBComment, format: (item) => { return Html.Raw(item.CountyEBComment); }),
     grid.Column("TeacherName", PessResources.Archive.TeacherName),
     grid.Column("GradeLevel", PessResources.Archive.GradeLevel),
     grid.Column("Gender", PessResources.Archive.Gender),
     grid.Column("PhoneNumber", PessResources.Archive.PhoneNumber),
     grid.Column("EducationDegree", PessResources.Archive.EducationDegree),
     grid.Column("SchoolName", PessResources.Archive.SchoolName),
     grid.Column("SchoolAddress", PessResources.Archive.SchoolAddress),
     grid.Column("SchoolPrincipal", PessResources.Archive.SchoolPrincipal),
     grid.Column("ProjectTitle", PessResources.Archive.ProjectTitle),
     grid.Column("ProjectSN", PessResources.Archive.ProjectSN),
     grid.Column("ReviewFeedback", PessResources.Archive.ReviewFeedback),
     grid.Column("Conclusion", PessResources.Archive.Conclusion),
     grid.Column("PreviousSN", PessResources.Archive.PreviousSN),
     grid.Column("SerialNumber", PessResources.Archive.SerialNumber)
     )
                             where Model.SelectedProperties.Contains(c.ColumnName)
                             select c)
    )
</fieldset>

<script language="javascript">
    function fly_test() {
        //if (document.getElementsByTagName("tr").length > 2) {
            document.getElementsByTagName("table")[0].className = "oddTable";
        //} else {
            // document.getElementsByTagName("table")[0].className = "none";
        //}
    }
</script>